package com.csii.activiti.server.core.entity.db;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableName;
import com.csii.activiti.server.core.entity.ActFlowConfiguration;
import com.csii.activiti.server.core.entity.BaseIdAndJsonData;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("act_e_flow_publish_config")
@NoArgsConstructor
@Data
public class ActFlowPublishConfigEntity extends BaseIdAndJsonData {
    private String flowName;
    private String flowKey;
    private String iconType;
    private String description;
    private String summary;
    private String manyConditionJson;

    public ActFlowPublishConfigEntity(String id , String flowName, String flowKey, String iconType, String description, String jsonData,String summary,String manyConditionJson){
        this.setId(id);
        this.setJsonData(jsonData);
        this.flowKey = flowKey;
        this.flowName = flowName;
        this.iconType = iconType;
        this.description = description;
        this.summary = summary;
        this.manyConditionJson = manyConditionJson;
    }

    public ActFlowConfiguration toActFlowConfiguration(){
        return JSONObject.parseObject(this.getJsonData(),ActFlowConfiguration.class);
    }
}
